<!DOCTYPE html>
<html>

<head>
  <script src="../node_modules/angular/angular.js"></script>
</head>

<body ng-app="demo">
  <div ng-controller="DemoController"></div>
  <script>
    // 定义一个模块
    const demo = angular.module('demo', [])
    // 定义一个服务
    demo.service('log', function () {
      return {
        info() {
          console.log('info')
        }
      }
    })
    // 定义一个控制器
    function DemoController(log) {
      log.info()
    }
    DemoController.$inject = ['log'] // 定义依赖注入
    demo.controller('DemoController', DemoController);
  </script>
</body>

</html>